import {
    VALIDATE,
    TO_LOGIN,
    LOGIN_OUT,
    SIGN_UP,
    CAPTCHA_IMG,
    EMAIL_CODE,
    FORGET_PSD,
    USER_BIND,
    IMAGE_LIST,
    EC2_HOLD,
    NOTIVELISTALL,
    NOTIVEUNREADLISTALL,
    CHANGENOTIVESTATE,
    NOTICEUNREADNUM,
    REPASSWORD,
    USERBALANCE,
    BILLRECORDS,
    RECHARGELIST,
    EC2RECORDS,
    EC2DOWNLOAD,
    GETCOUNTRYlIST,
    GETlNDUSTRYLIST,
    GETRESEARCHLIST,
    EC2START,
    EC2STOP,
    EC2TERMINATE,
    EC2DETAIL,
    PAYPALCHECKOUT,
    PAYPALPAYMENT,
    PAYPALCANCEL
} from '@/config/url';
import request from '@/utils/request';

// 校验一个用户是否登录
export const validate = () => {
    return request(VALIDATE);
};
// 登录
export const login = (data) => {
    return request(TO_LOGIN, { method: 'post', data });
};
export const signUp = (data) => {
    return request(SIGN_UP, { method: 'post', data });
};
export const loginOut = () => {
    return request(LOGIN_OUT);
};
export const captcha = (data) => {
    return request(CAPTCHA_IMG, { responseType: 'blob', data });
};
export const emailCode = (data) => {
    return request(EMAIL_CODE, {
        method: 'POST',
        isUrlParam: true,
        urlParams: { email: data.email, uuid: data.uuid, captcha: data.captcha },
    });
};
export const forgetPassword = (data) => {
    return request(FORGET_PSD,{ method: 'post', data });
};
export const imageList = (data) => {
    return request(IMAGE_LIST,{ data });
};
export const ec2Hold = (data) => {
    return request(EC2_HOLD,{ data });
};
export const userBind = (data) => {
    return request(USER_BIND, { method: 'post',data });
};
export const getCountryList = () => {
    return request(GETCOUNTRYlIST);
};
export const getIndustryList = () => {
    return request(GETlNDUSTRYLIST);
};
export const getResearchList = () => {
    return request(GETRESEARCHLIST);
};
export const getNoticeAll = (data) => {
    return request(NOTIVELISTALL, {data});
};
export const getNotiveUnreadAll = () => {
    return request(NOTIVEUNREADLISTALL);
};
export const changeNotiveStatus = (data) => {
    return request(CHANGENOTIVESTATE, {data});
};
export const noticeUnreadNum = () => {
    return request(NOTICEUNREADNUM);
};
export const repassword = (data) => {
    return request(REPASSWORD, {method:'post', data});
};
export const userBalance = () => {
    return request(USERBALANCE);
};
export const billRecords = (data) => {
    return request(BILLRECORDS, {data});
};
export const rechargelist = (data) => {
    return request(RECHARGELIST, {data});
};
export const ec2Records= (data) => {
    return request(EC2RECORDS, {data});
};
export const ec2Download= (data) => {
    return request(EC2DOWNLOAD, {data},{responseType: 'blob'});
};
export const ec2Start= (data) => {
    return request(EC2START, {data});
};
export const ec2Stop= (data) => {
    return request(EC2STOP, {data});
};
export const ec2Terminate= (data) => {
    return request(EC2TERMINATE, {data});
};
export const ec2Detail= (id) => {
    const url = `${EC2DETAIL}/${id}`
    return request(url);
};
export const paypalCheckout= (data) => {
    return request(PAYPALCHECKOUT, {method:'post', data});
};
export const paypalPayment= (orderId) => {
    const url = PAYPALPAYMENT.replace('{orderId}', orderId);
    return request(url);
};
export const paypalCancel= (data) => {
    return request(PAYPALCANCEL, {data});
};


